/******************************************************/
/* Goblin's Cube - Rubik's cube game for Wii Homebrew */
/* Copyright (C) 2009 Ricardo Bueno Cordeiro          */
/* Licensed under de GNU General Public License v2.0  */
/*   See license_gplv2.txt for detalis                */
/******************************************************/

#include <gccore.h>
#include <mutex.h>
#include <network.h>

#include "network.h"

static s32 mutex_status = -1;
static mutex_t mutex;
static s32 network_status = -1;

void init_network() {
	mutex_status = LWP_MutexInit(&mutex, true);
}

void close_network() {
	LWP_MutexDestroy(mutex_status);
}

s32 start_network() {
	Lock lock(mutex, mutex_status);

	if (network_status)
		network_status = if_config(NULL, NULL, NULL, true);

	return !network_status;
}
